*===============================================================================
* Do-file creates "Experimental Dataset: Violence and Other Economic Responses"
* Table A12
*===============================================================================
clear
set more off

cd "~/Dropbox/VFD/REStat_Native_Files/Stata_Files"
local output "~/Dropbox/VFD/REStat_Native_Files/Stata_Files/Output"

use cadg_master_NATIVE.dta, clear


gen sample=!missing(violence_34, cash_savings, bank_savings, transfer_amount, expenditure) & sample_cash_outlier==0 & sample_bank_outlier==0 & sample_transfer_outlier==0 & sample_expenditure_outlier==0


*===============================================================================
* Panel A
*===============================================================================

* Column 1
reghdfe bank_savings treat_post treat_final post if sample==1, ab(ym) cl(employeenumber) keepsing 
est store col1 
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 2
reghdfe bank_savings treat_post treat_final post if sample==1, ab(ym block_final) cl(employeenumber) keepsing
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 3
reghdfe bank_savings treat_post treat_final post if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 4
reghdfe bank_savings treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, ab(ym) cl(employeenumber) keepsing
est store col4 
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 5
reghdfe bank_savings treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, ab(ym block_final) cl(employeenumber) keepsing
est store col5
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 6
reghdfe bank_savings treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col6
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 7
reghdfe bank_savings violence_34 if sample==1, cl(employeenumber) ab(ym) keepsing
est store col7
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 8
reghdfe bank_savings violence_34 if sample==1, cl(employeenumber) ab(ym block_final) keepsing
est store col8
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 9
reghdfe bank_savings violence_34 if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col9
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)


* Export to Latex
esttab col1 col2 col3 col4 col5 col6 col7 col8 col9 using "`output'/table_a12a.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(treat_post treat_post_v34 violence_34) ///
stats(samplestr in_sample_mean N_clust N adjR2 monthFE stratumFE individFE, fmt(0 2 0 0 2 0 0 0)  label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Strata FE" "Employee FE")) ///
label title("Experimental Dataset: Violence and Other Economic Responses") replace 


*===============================================================================
* Panel B
*===============================================================================


* Column 1
reghdfe transfer_amount treat_post treat_final post if sample==1, ab(ym) cl(employeenumber) keepsing 
est store col1 
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 2
reghdfe transfer_amount treat_post treat_final post if sample==1, ab(ym block_final) cl(employeenumber) keepsing
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 3
reghdfe transfer_amount treat_post treat_final post if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 4
reghdfe transfer_amount treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, ab(ym) cl(employeenumber) keepsing
est store col4 
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 5
reghdfe transfer_amount treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, ab(ym block_final) cl(employeenumber) keepsing
est store col5
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 6
reghdfe transfer_amount treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col6
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 7
reghdfe transfer_amount violence_34 if sample==1, cl(employeenumber) ab(ym) keepsing
est store col7
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 8
reghdfe transfer_amount violence_34 if sample==1, cl(employeenumber) ab(ym block_final) keepsing
est store col8
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 9
reghdfe transfer_amount violence_34 if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col9
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)


* Export to Latex
esttab col1 col2 col3 col4 col5 col6 col7 col8 col9 using "`output'/table_a12b.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(treat_post treat_post_v34 violence_34) ///
stats(samplestr in_sample_mean N_clust N adjR2 monthFE stratumFE individFE, fmt(0 2 0 0 2 0 0 0)  label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Strata FE" "Employee FE")) ///
label title("Experimental Dataset: Violence and Other Economic Responses") replace 

*===============================================================================
* Panel C
*===============================================================================


* Column 1
reghdfe expenditure treat_post treat_final post if sample==1, ab(ym) cl(employeenumber) keepsing 
est store col1 
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 2
reghdfe expenditure treat_post treat_final post if sample==1, ab(ym block_final) cl(employeenumber) keepsing
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 3
reghdfe expenditure treat_post treat_final post if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 4
reghdfe expenditure treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, ab(ym) cl(employeenumber) keepsing
est store col4 
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 5
reghdfe expenditure treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, ab(ym block_final) cl(employeenumber) keepsing
est store col5
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 6
reghdfe expenditure treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col6
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)

* Column 7
reghdfe expenditure violence_34 if sample==1, cl(employeenumber) ab(ym) keepsing
est store col7
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "NO"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 8
reghdfe expenditure violence_34 if sample==1, cl(employeenumber) ab(ym block_final) keepsing
est store col8
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "YES"
estadd local individFE "NO"
estadd scalar adjR2 =  e(r2_a)

* Column 9
reghdfe expenditure violence_34 if sample==1, cl(employeenumber) ab(employeenumber ym) keepsing
est store col9
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"
estadd scalar adjR2 =  e(r2_a)


* Export to Latex
esttab col1 col2 col3 col4 col5 col6 col7 col8 col9 using "`output'/table_a12c.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(treat_post treat_post_v34 violence_34) ///
stats(samplestr in_sample_mean N_clust N adjR2 monthFE stratumFE individFE, fmt(0 2 0 0 2 0 0 0)  label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Strata FE" "Employee FE")) ///
label title("Experimental Dataset: Violence and Other Economic Responses") replace 





